html, body, p, ol, ul, li, dl, dt, dd, blockquote, figure, fieldset, legend, textarea, pre, iframe, hr, h1, h2, h3, h4, h5, h6 {
  margin: 0;
  padding: 0
}

h1, h2, h3, h4, h5, h6 {
  font-size: 100%;
  font-weight: normal
}

ul {
  list-style: none
}

button, input, select, textarea {
  margin: 0
}

html {
  box-sizing: border-box
}

*, *:before, *:after {
  box-sizing: inherit
}

img, embed, iframe, object, audio, video {
  height: auto;
  max-width: 100%
}

iframe {
  border: 0
}

table {
  border-collapse: collapse;
  border-spacing: 0
}

td, th {
  padding: 0;
  text-align: left
}

// <libs>
@import '../../node_modules/codemirror/lib/codemirror.css';
@import '../../node_modules/codemirror/theme/material.css';
@import '../../node_modules/codemirror/theme/xq-light.css';
@import '../../node_modules/prismjs/themes/prism.css';

.react-codemirror2 {
  flex: 1 1 auto;
  margin-top: 0;
  height: 100%;
  position: relative;
}

.CodeMirror {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
}

// </libs>

html, body, #app {
  height: 100%;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  min-width: 600px;
}

#app {

  padding-top: 2em;

  #container {
    width: 80%;
    margin: 0 auto;

    header {

      #doc-v {
        font-size: 14pt;
        padding: 0.125em 0.250em;
        margin-right: 0.500em;
        position: relative;
        bottom: 0.125em;
        user-select: none;
        color: #777;

        i {
          color: #ddd;
        }
      }

      a {

        &:link {
          text-decoration: none;
        }

        h1 {
          font-size: 18pt;
          color: dodgerblue;
          padding: 0.500em 0;
          display: inline-block;

          i {
            margin-right: 0.250em;

            &:last-of-type {
              font-size: 8pt;
              position: relative;
              top: -0.750em;
              left: 0.250em;
            }
          }

          &:hover {
            color: darken(dodgerblue, 20%);
          }
        }
      }
    }

    #controls {
      padding: 0.250em 0.750em;
      height: 2.500em;
      background-color: #f5f2f0;
      border: solid 1px #ddd;

      select {
        margin-right: 1.000em;
        height: 20px;
      }
    }

    #pane-container {

      box-shadow: 0 4px 2px -2px #ccc;
      height: 30em;

      section {
        width: 50%;
        height: 100%;
        float: left;

        &:last-of-type {
          border-bottom: solid 1px #ddd;
          border-right: solid 1px #ddd;
        }
      }
    }
  }
}

pre.syntax-block {
  height: 100%;
  font-size: 10pt;
  margin: 0;
  padding: 1em;
  overflow: auto;
  background-color: #f5f2f0;
  color: black;
  text-shadow: 0 1px white;
  font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  word-wrap: normal;
  line-height: 1.5;
  tab-size: 4;
  hyphens: none;
}

@mixin can-toggle-branding(
  $can-toggle-off-color: #978edc,
  $can-toggle-on-color: #777,
  $can-toggle-inactive-text: rgba(white, 0.5),
  $can-toggle-transition: cubic-bezier(0,1,0.5,1)
) {

  input[type="checkbox"] {

    &[disabled] ~ label {
      color: rgba($can-toggle-off-color, 0.5);
    }

    &:focus ~ label, &:hover ~ label {
      .can-toggle__switch {
        background-color: $can-toggle-off-color;
        &:after {
          color: darken($can-toggle-off-color, 10%);
        }
      }
    }
    &:hover ~ label {
      color: darken($can-toggle-off-color, 5%);
    }
    &:checked {
      ~ label {
        &:hover {
          color: darken($can-toggle-on-color, 3%);
        }

        .can-toggle__switch {
          background-color: lighten($can-toggle-on-color, 5%);
          &:after {
            color: darken($can-toggle-on-color, 5%);
          }
        }
      }

      &:focus, &:hover {
        ~ label {
          .can-toggle__switch {
            background-color: $can-toggle-on-color;
            &:after {
              color: darken($can-toggle-on-color, 10%);
            }
          }
        }
      }
    }
  }
  input[type="checkbox"] {

    &[disabled] ~ label {
      color: rgba($can-toggle-off-color, 0.5);
    }

    &:focus ~ label, &:hover ~ label {
      .can-toggle__switch {
        background-color: $can-toggle-off-color;
        &:after {
          color: darken($can-toggle-off-color, 10%);
        }
      }
    }
    &:hover ~ label {
      color: darken($can-toggle-off-color, 5%);
    }
    &:checked {
      ~ label {
        &:hover {
          color: darken($can-toggle-on-color, 3%);
        }

        .can-toggle__switch {
          background-color: lighten($can-toggle-on-color, 5%);
          &:after {
            color: darken($can-toggle-on-color, 5%);
          }
        }
      }

      &:focus, &:hover {
        ~ label {
          .can-toggle__switch {
            background-color: $can-toggle-on-color;
            &:after {
              color: darken($can-toggle-on-color, 10%);
            }
          }
        }
      }
    }
  }

  label {

    .can-toggle__label-text {
      flex: 1;
    }

    .can-toggle__switch {
      transition: background-color 0.3s $can-toggle-transition;
      background: lighten($can-toggle-off-color, 5%);
      &:before {
        color: $can-toggle-inactive-text;
      }
      &:after {
        // Autoprefixer choked here, so making the prefixes explicit
        -webkit-transition: -webkit-transform 0.3s $can-toggle-transition;
        transition: transform 0.3s $can-toggle-transition;
        color: $can-toggle-off-color;
      }
    }
  }
}

$toggle-container-width: 240px;

// toggle
@mixin can-toggle-appearance(
  $can-toggle-width: $toggle-container-width,
  $can-toggle-height: 20px,
  $can-toggle-border-radius: 0,
  $can-toggle-offset: 2px,
  $can-toggle-label-font-size: 12px,
  $can-toggle-switch-font-size: 12px
) {
  $can-toggle-switch-width: $can-toggle-width / 2;

  input[type="checkbox"] {

    &:checked {
      ~ label {
        .can-toggle__switch {
          &:after {
            transform: translate3d($can-toggle-width - ($can-toggle-switch-width + $can-toggle-offset), 0, 0);
          }
        }
      }
    }
  }

  label {
    font-size: $can-toggle-label-font-size;

    .can-toggle__switch {
      height: $can-toggle-height;
      flex: 0 0 $can-toggle-width;
      border-radius: $can-toggle-border-radius;

      &:before {
        left: $can-toggle-width/2;
        font-size: $can-toggle-switch-font-size;
        line-height: $can-toggle-height;
        width: $can-toggle-width/2;
        padding: 0 12px;
      }

      &:after {
        top: $can-toggle-offset;
        left: $can-toggle-offset;
        border-radius: $can-toggle-border-radius/2;
        width: $can-toggle-switch-width - $can-toggle-offset;
        line-height: $can-toggle-height - ($can-toggle-offset*2);
        font-size: $can-toggle-switch-font-size;
      }
    }
  }
}

.can-toggle {
  position: relative;
  display: block;
  *, *:before, *:after {
    box-sizing: border-box;
  }

  input[type="checkbox"] {
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;

    &[disabled] ~ label {
      pointer-events: none;
      .can-toggle__switch {
        opacity: 0.4;
      }
    }

    &:checked {
      ~ label {

        .can-toggle__switch {

          &:before {
            content: attr(data-unchecked);
            left: 0;
          }

          &:after {
            content: attr(data-checked);
          }
        }
      }
    }
  }

  label {
    user-select: none;
    position: relative;
    display: flex;
    align-items: center;

    .can-toggle__label-text {
      flex: 1;
      padding-left: 32px;
    }

    .can-toggle__switch {
      position: relative;

      &:before {
        content: attr(data-checked);
        position: absolute;
        top: 0;
        text-transform: uppercase;
        text-align: center;
      }

      &:after {
        content: attr(data-unchecked);
        position: absolute;
        z-index: 5;
        text-transform: uppercase;
        text-align: center;
        background: white;
        transform: translate3d(0, 0, 0);
      }
    }
  }

  @include can-toggle-branding;
  @include can-toggle-appearance;
}

.toggle-container {
  display: inline-block;
  width: $toggle-container-width;
}

.state-control {
  position: relative;
  top: 6px;

  label {
    cursor: pointer;
  }
}
